package org.wdcode.common.config;

import java.io.File;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;

import org.wdcode.common.exception.CustomRuntimeException;

/**
 * 读取XML配置类<br/>
 * <h2>注: 使用本类需依赖 Apache Commons-Configuration包</h2> <h2>注: 内部使用</h2>
 * @author WD
 * @since JDK6
 * @version 1.0 2009-03-25
 */
@SuppressWarnings("unchecked")
final class XMLConfig extends XMLConfiguration implements ConfigManage {
	// 序列化ID
	private static final long	serialVersionUID	= 3644860975969575665L;

	/**
	 * 构造函数
	 * @param fileName
	 * @throws ConfigurationException
	 */
	public XMLConfig(String fileName) throws ConfigurationException {
		super(fileName);
	}

	/**
	 * 构造函数
	 * @param file
	 * @throws ConfigurationException
	 */
	public XMLConfig(File file) throws ConfigurationException {
		super(file);
	}

	/**
	 * 写配置文件
	 */
	public final void write() {
		try {
			save();
		} catch (ConfigurationException e) {
			throw new CustomRuntimeException(e);
		}
	}
}
